/**
 * 
 *  @project Air Traff Monitor
 * 
 *  @author M.Emre ATASEVER <m.emre.atas@gmail.com>
 *  @author M.Burak ALKAN <mburakalkan@gmail.com>
 *  @author H.Burak KARAMIK <bkaramik@gmail.com>
 *
 *	`Air Traffic Monitor' is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *	GNU General Public License for more details.
 *
 *	You should have received a copy of the GNU General Public License
 *	along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#include "statview.h"
#include <QHeaderView>


QKismetStatusWnd::QKismetStatusWnd(QKismetSocket *sock)
{
	view	= new QKismetStatusView(sock);
	toolbar	= new QKismetViewToolBar(view);

	view->popupMenu->addSeparator();
	view->popupMenu->addAction(toolbar->toggleViewAction());
	
	setCentralWidget(view);
	addToolBar(toolbar);
}
QKismetStatusWnd::~QKismetStatusWnd()
{
	delete view;
	delete toolbar;
}

QKismetStatusDock::QKismetStatusDock(QKismetSocket *sock)
{
	hide();
	
	tree	= new QKismetStatusWnd(sock);

	QAction *a = toggleViewAction();
	a->setIcon(QIcon(":/img/text-x-generic.png"));
	a->setStatusTip("Toggle status messages window");
	setWindowTitle("Status messages");



	setWidget(tree);
}
QKismetStatusDock::~QKismetStatusDock()
{
	delete tree;
}
	

QKismetStatusView::QKismetStatusView(QKismetSocket *sock) : QKismetTreeView(new StatusModel(sock))
{
	connect(aclear,SIGNAL(triggered()),model(),SLOT(clear()));
	setRootIsDecorated(false);
	header()->setResizeMode(QHeaderView::ResizeToContents);
	header()->hide();
	setAutoScroll(true);
	setSelectionMode(QAbstractItemView::ExtendedSelection);
}
